
$.notify = {};
$(function(o){
	o.updateData = function(showArea,mid){
		console.log(showArea)
		var reqUrl = "/meat/sec/block/get?mid="+mid;
		$.ajax({
			type : "GET",
			url  : reqUrl,
			dataType: 'json',
			success : function(obj){
				console.log(obj);
				if(obj.code==1){
					if(obj.data.block==1){//blocked
						$(showArea).modal({backdrop: 'static', keyboard: false});
						$("#modal_msg2").text("You are blocked, not allow to manage food!");
//						window.location.href="/meat/block.jsp";
					}else{
						$(showArea).modal("hide");
						console.log("relieve");
//						showArea.modal("show");
//						$("#modal_msg").text("You can manage food now!");
//						$("#modal_btn").text("Back").click(function () {
//							/* body... */
//							showArea.modal("hide");					
//						});
					}
                }

			}
		});
	};
	
	o.work = function(showArea,mid,ms){
		window.setInterval( function(){ o.updateData(showArea,mid); } , ms );
	};
	
	o.getUrlParam = function(name){
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
	};
	
}($.notify));
